﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Coolite.Ext.Web;

namespace Sagacity.NC.Web.BasicSettings
{
    public partial class SchoolsList : PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
                this.TabFormCommon1.Filters.Add(new Sagacity.Entity.Query.FilterInfo("School_Id","=",0));
            
            this.TabFormCommon1.ResourceId = int.Parse(hidResourceId.Value);
            this.TabFormCommon1.CurrentUser = CurrentUser;
            AddButton();
        }

        public void AddButton()
        {
            //增加按钮
            Coolite.Ext.Web.ToolbarButton btnAdds = new Coolite.Ext.Web.ToolbarButton();
            btnAdds.ID = "btnTestNum";
            btnAdds.Visible = true;
            btnAdds.Enabled = true;
            btnAdds.Text = "生成报名号";
            btnAdds.Icon = Icon.ApplicationKey;
            btnAdds.Listeners.Click.Handler = "javascript:TestNumOnClick();";
            this.TabFormCommon1.BtnControls.Add(btnAdds);
        }
        [AjaxMethod]
        public bool SerialNumOnClick()
        {
            bool flag = false;
            try {
             flag=(new Business.SchoolManage.SchoolManage()).UpdateStudentInfoCode(CurrentUser.LoginRole.Id);
            }
            catch (Exception ext)
            {
                flag = false;
            }

            return flag;
            
        }

    }
}
